package ldh.fx.adminfx.util;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class ThreadPoolUtil {

    private static final ExecutorService executorService = Executors.newFixedThreadPool(2);

    public static void close() {
        executorService.shutdown();
    }

    public static <V> Future<V> submit(Callable<V> callable) {
        return executorService.submit(callable);
    }

    public static <V> Future<V> submit(Runnable runnable) {
        return (Future<V>) executorService.submit(runnable);
    }
}
